import { useLoginStatus, useLoginUrl } from '@/hooks/login';
import styles from './index.less';
interface LoginProps {
  type?: 'default' | 'custom';
}
const Login: React.FC<LoginProps> = ({ type = 'default', children }) => {
  const isLogin = useLoginStatus();
  const loginUrl = useLoginUrl();
  if (isLogin === true || isLogin === undefined) return null;

  return (
    <a href={loginUrl} className={styles.login}>
      {type === 'default' ? <div className={styles.button}>注册/登录</div> : <div>{children}</div>}
    </a>
  );
};

export default Login;
